chore: populate swap intent metrics and rename txHistory keys#7564
chore: populate swap intent metrics and rename txHistory keys#7564
Conversation
There was a problem hiding this comment.
Single string `txHashes` in metadata is silently discarded
Medium Severity
The IntentOrderResponseSchema at line 78 in validators.ts allows metadata.txHashes to be either an array of hex strings or a single hex string via union([array(StrictHexStruct), StrictHexStruct]). However, the code at line 770-772 only handles the array case: when txHashes is a single string, Array.isArray() returns false, causing metadataTxHashes to become an empty array and silently discarding the hash value. If txHash is also undefined, transaction hashes could be lost entirely.
packages/bridge-status-controller/src/bridge-status-controller.ts#L769-L772
core/packages/bridge-status-controller/src/bridge-status-controller.ts
Lines 769 to 772 in 06c1583
packages/bridge-status-controller/src/utils/validators.ts#L76-L79
core/packages/bridge-status-controller/src/utils/validators.ts
Lines 76 to 79 in 06c1583
`CANCELLED` intent status incorrectly maps to `submitted` instead of `failed`
Medium Severity
The IntentOrderStatus.CANCELLED enum value is defined but not handled in the status mapping logic. In mapIntentOrderStatusToTransactionStatus, a cancelled order falls through to the default case and incorrectly returns TransactionStatus.submitted. Similarly, in #updateHistoryAndTxFromIntentOrder, cancelled orders fall through to StatusTypes.UNKNOWN. A cancelled intent order is a terminal failed state and should map to failed status, like EXPIRED does, rather than appearing as an active or unknown transaction.
packages/bridge-status-controller/src/utils/intent-api.ts#L102-L118
core/packages/bridge-status-controller/src/utils/intent-api.ts
Lines 102 to 118 in 06c1583
packages/bridge-status-controller/src/bridge-status-controller.ts#L745-L764
core/packages/bridge-status-controller/src/bridge-status-controller.ts
Lines 745 to 764 in 06c1583
fdba719 to
e530943
Compare
…-swap-architecture-refactory-txHistory-metrics
…-swap-architecture-refactory-txHistory-metrics
…-swap-architecture-refactory-txHistory-metrics
f373323 to
a16e6ae
Compare
a16e6ae to
7a0f130
Compare
Explanation
References
Checklist
Note
Adds full intent-based swap/bridge flow and wiring across controllers.
submitIntentaction, polling viaIntentApiImpl(submit/getOrderStatus), maps intent statuses to bridgeStatusTypes(incl. newSUBMITTED), recordsintentOrderIdand aggregatedsrcTxHashes, updates TC tx status, event tracking adjustments; tests and snapshots added; coverage config tweakedIntent/IntentOrderLike;Quotenow optionally includesintent; validators addIntentOrderSchema/IntentSchemaand helpersutils/intent-api.ts) with validation and status mapping + testsWritten by Cursor Bugbot for commit 06c1583. This will update automatically on new commits. Configure here.